package com.example.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class userConfig3 implements InitializingBean {

    @Bean
    @ConfigurationProperties(prefix = "people")
    public User user(){
        return new User();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println(user().getName() + user().getAge());
    }
}
